﻿using System;
using System.Collections.Generic;
using System.Text;
using NLBS.Entity;
using NLBS.Data.Business;

namespace NLBS.Views.Admin
{
    public class UserGroupPresenter : Presenter<IFirstContentView, IAction<UserGroup>>
    {

        public override void OnActionLoaded()
        {
            base.OnActionLoaded();
            this.Action.DataSelectSingle += new EventHandler(Action_DataSelectSingle);
            this.Action.DataInsert += new EventHandler(Action_DataInsert);
            this.Action.DataUpdate += new EventHandler(Action_DataUpdate);
            this.Action.DataDelete += new EventHandler(Action_DataDelete);
        }

        void Action_DataDelete(object sender, EventArgs e)
        {
            UserGroupData.DeleteUserGroup(this.Action.keyID);
        }

        void Action_DataUpdate(object sender, EventArgs e)
        {
            UserGroupData.UpdateUserGroup(this.Action.Entity);
        }

        void Action_DataSelectSingle(object sender, EventArgs e)
        {
            this.Action.Entity = UserGroupData.GetUserGroupByID(this.Action.keyID);
        }

        void Action_DataInsert(object sender, EventArgs e)
        {
            UserGroupData.InsertUserGroup(this.Action.Entity);
        }
    }
}
